﻿using Station.Inspect;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SASJL
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Test();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new FormMain());
            Directory.SetCurrentDirectory("D:\\2\\");
            MainConfig.Init();
            StaInspect.Instance.Bind(MainConfig.camera, MainConfig.mc);
            StaInspect.Instance.OnInspectFinished += Instance_OnInspectFinished;
            StaInspect.Instance.Rbt.Home(40, true);
            Application.Run(new FormInspect());
            MainConfig.UInit();
        }

        //检测结果
        private static void Instance_OnInspectFinished(object sender, ResultEventArgs e)
        {
            //bool isNG = e.Result.CellInfos[0].IsNG; //cell 0是否为NG
            //PointF posA = e.Result.CellInfos[0].DicCell["A"].RealPos;    //cell 0 A面物理坐标
            //PointF posB = e.Result.CellInfos[0].DicCell["B"].RealPos;    //cell 0 A面物理坐标
            e.Result.Save();//保存数据
        }

        static void Test()
        {
            Matrix matrix = new Matrix();
            matrix.Translate(-50, 0);
            matrix.RotateAt(90,new PointF(100,0));//绕局部
            PointF[] pts = new PointF[1];
            pts[0] = new PointF(100, 200);
            matrix.TransformPoints(pts);//1000,100;0,1100
        }
    }
}
